﻿using FluentNHibernate.Mapping;
using Kratos.Framework.ContentManagement.Models.SystemRights;

namespace Kratos.Framework.ContentManagement.Maps.SystemRights
{
    public class MenuPermissionMap : ClassMap<MenuPermission>
    {
        public MenuPermissionMap()
        {
            Id(m => m.Id).GeneratedBy.Identity().UnsavedValue(null);
            Map(m => m.ActionName);
            Map(m => m.ControllerName);
            Map(m => m.ActionDescription);
            Map(m => m.ControllerDescription);
            Map(m => m.PrevIcon).Default("menu_default");
            Map(m => m.MenuName);
            Map(m => m.ParentId);
            Map(m => m.Url);
            Map(m => m.CreateTime).Default("1900-1-1");
            Map(m => m.NodeLevel).Default("1");
            Map(m => m.Enabled).Default("false");

            HasMany(x => x.Children).KeyColumn("ParentId");
        }
    }
}
